Some contemporary computing devices, such as mobile telephones, have limited resources including memory and processing power, yet also run computer programs. Devices that have more sophisticated platforms are able to run precompiled programs as well as run managed code, in which runtime environments interpret or just-in-time compile program code; the term “managed code” is generally used herein to refer to any software code that contains one or more programs that are not in the CPU's native instruction set and/or have memory functionality managed for them by the system. In many cases, the operating system employs virtual memory-based memory-mapped files, wherein the entire file is shown as appearing in memory, but the operating system actually loads memory units in and out of actual RAM based on their usage. Hardware support handles much of the checking as to whether swapping is needed.
Other devices have platforms that do not allow virtual memory and/or memory mapping techniques to be used. Such devices in general are able to run pre-compiled programs, but often cannot efficiently run programs written in managed code, or the functionality of the program is limited relative to pre-compiled programs because of memory consumption. One reason is that without memory mapping, to efficiently run, an entire program file needs to fit into memory, which (unless the size of the program is severely limited) tends to consume so much space that there is not sufficient memory available for the framework that is needed to run the managed code. Another reason is that hardware support for caching may not be present, whereby code is required to be run to perform checks as to whether file data needs to be loaded. This slows performance drastically. Moreover, even if hardware support was provided, accessing the storage (which may be additional memory containing a compressed version of the file to be run) is highly inefficient and slow, due to the caching mechanism needing to repeatedly access the file system and/or decompress file data in order to fill the cache with needed file-based code and data.
What is needed is a way to efficiently run managed code, particularly on platforms that do not support virtual memory and/or memory mapping. The solution should be efficient in the amount of memory consumed, as well as in maintaining high performance and in limiting swapping between memory and storage.